package com.frxuexi.lib_base.scan

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import java.io.File

object LocalUtil {
    fun getLocalFiles(path:String): Flow<List<LocalDocEntity>> {
        return flow{
            val file = File(path)
            val listFiles = file.listFiles()
            val list = mutableListOf<LocalDocEntity>()
            listFiles.forEach {
                if(it.isFile){
//                    Log.i("===",it.path)
                    list.add(LocalDocEntity(it.name,it.path))
                }
            }
            emit(list)
        }


    }
}